package net.waret.thymeleaf.web;

import net.waret.thymeleaf.config.ConfigDemo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import sun.security.krb5.Config;

@Controller
public class IndexController {

    @Autowired
    private ConfigDemo configDemo;

    @ResponseBody
    @RequestMapping("/hello")
    public String hello() {
        return "Hello World";
    }

    @RequestMapping("/index")
    public String index(ModelMap map) {
        map.addAttribute("host", "http://baidu.com");
        map.addAttribute("port", configDemo.getPort());
        return "index";
    }

}